package ui;
import java.awt.BorderLayout;
import java.awt.EventQueue;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;

import javax.swing.JTextField;
import javax.swing.JPasswordField;
import net.miginfocom.swing.MigLayout;


public class login extends JFrame {

	private JPanel contentPane;
	private JTextField txtUsername;
	private JPasswordField passwordField;
	private JButton btnForgotPassemail;
	private JButton btnRegister;
	private JButton btnLogin;

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		EventQueue.invokeLater(new Runnable() {
			public void run() {
				try {
					login frame = new login();
					frame.setVisible(true);
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
	}

	/**
	 * Create the frame.
	 */
	public login() {
		
		
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setBounds(100, 100, 300, 400);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		contentPane.setLayout(new MigLayout("", "[86px][89px][147px]", "[23px][][][][][4px][23px][23px]"));
		
		txtUsername = new JTextField();
		txtUsername.setText("Username");
		contentPane.add(txtUsername, "cell 0 0 3 1,growx,aligny center");
		txtUsername.setColumns(10);
		
		passwordField = new JPasswordField("password");
		contentPane.add(passwordField, "cell 0 1 3 1,growx,aligny top");
		
		btnLogin = new JButton("Login");
		btnLogin.addMouseListener(new MouseAdapter() {
			@Override
			public void mousePressed(MouseEvent e) {
				
				home x = new home();
				x.setVisible(true);
				dispose();
				
				char[] password = passwordField.getPassword();
				
			}
		});
		contentPane.add(btnLogin, "cell 2 2,grow");
		
		btnRegister = new JButton("Register");
		btnRegister.addMouseListener(new MouseAdapter() {
			//switches to register.java (register a user JFrame)
			public void mousePressed(MouseEvent e) {
				register x = new register();
				x.setVisible(true);
				dispose();
			}
		});
		contentPane.add(btnRegister, "cell 2 3,growx,aligny top");
		
		btnForgotPassemail = new JButton("Forgot pass/email");
		btnForgotPassemail.addMouseListener(new MouseAdapter() {
			//switches to forgot.java (forgot password JFrame)
			public void mousePressed(MouseEvent e) {
				forgot x = new forgot();
				x.setVisible(true);
				dispose();
			}
		});
		contentPane.add(btnForgotPassemail, "cell 2 4,growx,aligny top");
	}

}
